package com.shop.order.service;


import com.api.openfeign.client.ProductClient;

import com.api.openfeign.dto.ProductInfoDto;
import com.shop.order.repository.OrderMasterRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
@Slf4j
@Service
public class OrderServiceImpl {
    @Autowired
    OrderMasterRepository orderMasterRepository;
     @Autowired
     private RestTemplate restTemplate;
     @Autowired
     private ProductClient productClient;
     public ProductInfoDto QueryOrder(String orderId) {
        // ProductInfoDto productInfoDto = restTemplate.getForObject("http://product-service/product/index?productId="+orderId, ProductInfoDto.class);
         ProductInfoDto productInfoDto = productClient.getProductId(orderId);
        log.info("productInfoDto:{}", productInfoDto);
        return productInfoDto;
     }
}
